<?php

namespace app\common\model;

use think\Model;

class User extends Model
{
    protected $pk = 'uid';
    protected $autoWriteTimestamp = true;

    protected $json = ['tag_str'];
    // 设置JSON数据返回数组
    protected $jsonAssoc = true;

    public function group()
    {
        return $this->hasOne("Group", "group_id", "group_id");
    }

    public function getGenderAttr($value)
    {
        $status = [0=>'未知',1=>'男',2=>'女'];
        return $status[$value];
    }
    public static function getList($where = "", $order = "uid desc", $paginate = 10)
    {
        $list = self::where($where)->order($order)->paginate($paginate);
        $list->hidden(['openid'])->toArray();
        return $list;
    }
}
